import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;

public class App2 {
    public static void main(String[] args) {
        //1，得到spring 上下文对象
        BeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource("spring-config.xml"));
        //2，从spring 容器中获取bean对象
        //Student student = (Student) beanFactory.getBean("student"); //
        //Student  student = beanFactory.getBean(Student.class);      //
        Student student = beanFactory.getBean("student",Student.class);  //
        //3，调用Bean对象
        student.sayHi();
    }
}
